home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / c / GED4DCC.lha / GoldED_ErrorParse.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1995-02-03  |  3.1 KB  |  123 lines

  1. /*
  2. ** $VER: GoldED_ErrorParse.rexx 1.002 (03.02.95) © Gian Maria Calzolari
  3. **
  4. **
  5. **  FUNCTION:
  6. **      DICE Error Parsing Script.  Script for GoldEd © Dietemar Eilert
  7. **
  8. **  Notes: This assumes that your DCC:Config/DCC.Config file contains the
  9. **         following line:
  10. **  cmd= rx DCC:Rexx/GoldED_ErrorParse.rexx %e "%c" "%f" "%0"
  11. **
  12. ** $HISTORY:
  13. **
  14. ** 03 Feb 1995 : 001.002 : It wasn't able to handle an erron in 'column 0'
  15. ** 07 Jan 1995 : 001.001 : First not-beta release. Now it goes also to the
  16. **                          column with the error
  17. ** 19 Nov 1994 : 000.003 : ...also the error(s) file will be loaded
  18. ** 18 Nov 1994 : 000.002 : Now it will open a new window only if the current
  19. **                          one is not empty and the file isn't already loaded
  20. ** 12 Nov 1994 : 000.001 : Created by Gian Maria Calzolari (2:332/502.11
  21. **                          2:332/801.19), derives from CED_ErrorParse.rexx
  22. **
  23. */
  24.  
  25. OPTIONS RESULTS
  26.  
  27. PARSE ARG EFile '"' Fn '" "' CurDir '" "' CFile '" "' VPort '"'
  28.  
  29. IF VPort = '?' THEN VPort = ''
  30.  
  31. portname = 'DICE_ERROR_PARSER'  /* DICEHelp's port name */
  32.  
  33. if ~show('p',portname) then do
  34.     address COMMAND 'RUN >NIL: <NIL: DError REXXSTARTUP'
  35.  
  36.     do i = 1 to 6
  37.  
  38.         if ~show('p',portname) then address COMMAND 'wait 1'
  39.  
  40.         if ~show('p',portname) then do
  41.             say "Dice Error Parser (DERROR) program not found!"
  42.             address COMMAND 'type' EFile
  43.             exit
  44.         end
  45.     end
  46. end
  47.  
  48. /**
  49.  ** Get the error messages loaded in.
  50.  ** This will return a list of lines within the file that have
  51.  ** errors associated with them (if any)
  52.  **/
  53.  
  54. ADDRESS DICE_ERROR_PARSER LOAD EFile '"'CurDir'" "'Fn'" "'VPort'"'
  55. LINES = RESULT
  56.  
  57. /**
  58.  ** Get info on the current error
  59.  **/
  60.  
  61. ADDRESS DICE_ERROR_PARSER Current E
  62.  
  63. IF rc ~= 0 THEN DO
  64.     SAY 'No More Errors'
  65.     exit 0
  66. END
  67.  
  68. IF E.LINE = 0 THEN DO
  69.  
  70.     IF LEFT(E.TEXT, 5) = 'DLINK' THEN DO
  71.         /* This is a DLINK error, we need to handle it special */
  72.         SAY 'There were DLINK Errors'
  73.         ADDRESS COMMAND TYPE EFILE
  74.         exit 0
  75.     END
  76. END
  77.  
  78. if ~show('p', 'GOLDED.1') then do
  79.     address COMMAND 'RUN >NIL: <NIL: ed'
  80.  
  81.     IF RC ~= 0 THEN DO
  82.       Say 'Unable to open GoldED'
  83.       exit 0
  84.     END
  85. end
  86.  
  87. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then address 'GOLDED.1'
  88.  
  89. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  90. OPTIONS FAILAT 6                            /* ignore warnings         */
  91. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  92.  
  93. /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
  94.  
  95. 'QUERY DOC'
  96.  
  97. if (result ~= E.FPATH) then 'OPEN NAME' E.FPATH SMART
  98.  
  99. 'GOTO LINE'     E.LINE              /* Jump straight to the line number. */
  100.  
  101. if E.COL > 0 then
  102.     'GOTO COLUMN'   E.COL               /* Jump straight to the column number. */
  103.   else
  104.     'GOTO COLUMN'   1
  105.  
  106. 'OPEN NAME' EFile SMART             /* Open the file with all the errors. */
  107.  
  108. 'WINDOW ARRANGE 0'
  109.  
  110. 'REQUEST PROBLEM="' || E.ERRNO E.STRING || '"'
  111.  
  112. /* ---------------------------- END OF YOUR CODE --------------------- */
  113.  
  114. 'UNLOCK' /* VERY important: unlock GUI */
  115. EXIT
  116.  
  117. SYNTAX:
  118.  
  119. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  120. 'UNLOCK'
  121. EXIT
  122.  
  123.